<template>
  <div class="app-container">
    <RouterView v-slot="{ Component, route }">
      <transition name="fade" mode="out-in">
        <KeepAlive>
          <component :is="Component" :key="route.fullPath" />
        </KeepAlive>
      </transition>
    </RouterView>
  </div>
</template>

<script setup lang="ts">
import { RouterView } from 'vue-router'
// 可以放全局逻辑，比如主题监听、状态管理等
</script>

<style scoped>
.app-container {
  width: 100%;
  height: 100%;
}

/* 页面切换动画 */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s;
}
.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>
